<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box1 {
      width: 100px;
      height: 100px;
      border: 10px solid red;
      padding: 20px;
      background: green;
      /* 
      盒子宽度: width+border-left-width + border-right-width + padding-left + padding-right,
      内容宽度: width
      */
      box-sizing: content-box;
    }

    #box2 {
      width: 100px;
      height: 100px;
      border: 10px solid red;
      padding: 20px;
      background: green;
      /* 
      盒子宽度: width, 
      真实内容宽度: width - padding-left - padding-right - border-left-width - border-right-width
       */
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <div id="box1"></div>
  <br />
  <div id="box2"></div>
</body>

</html>